class Solution {
public:
    int dp[1005];
    int minCostClimbingStairs(vector<int>& cost) {
        dp[0]=0;
        dp[1]=cost[0];
        int len=cost.size();
        for(int i=2;i<=len;i++){
            dp[i]=min(dp[i-1],dp[i-2])+cost[i-1];
        }
        return min(dp[len],dp[len-1]);
    }
};